package com.ycz.pattern.behaviour.visitorpattern;

/**
 * @author yancz
 * @ClassName Computer
 * @description: TODO
 * @date 2023-12-01 16:47:03
 * @version: 1.0
 */
public class Computer implements ComputerPart {

    ComputerPart[] parts;

    public Computer() {
        parts = new ComputerPart[]{new Mouse(),new Keyboard(),new Monitor()};
    }

    @Override
    public void accept(ComputerPartVisitor computerPartVisitor) {
        for(int i=0;i<parts.length;i++) {
            parts[i].accept(computerPartVisitor);
        }
        computerPartVisitor.visit(this);
    }
}
